<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>社医堂</title>
<link rel="stylesheet" type="text/css" href="../../../css/hui.css" />
<link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
</head>
<body>
<style type="text/css">
.hui-speed-dial ul li{width:25%;}
.hui-speed-dial-text{line-height:20px;}
</style>
	

<div class="hui-wrap">

	
    <div style="margin:20px 10px; margin-bottom:15px;" class="hui-form" id="form1">

        <div class="hui-form-items">
        	<div class="hui-form-items-title">新密码</div>
            <input id="password1" value="" type="text" class="hui-input hui-input-clear" placeholder='' />
        </div>

        <div class="hui-form-items">
        	<div class="hui-form-items-title">确认密码</div>
            <input id="password2" value="" type="text" class="hui-input hui-input-clear" placeholder='' />
        </div>
        

    </div>
    <div style="padding:10px; padding-top:10px;">
        <button onclick="save()" type="button" class="hui-button hui-button-large hui-primary" style="width:100%;float:left;">修改密码</button>
    </div>	
	
</div>


<script src="../../../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/hui-tab.js" type="text/javascript"></script>
<script src="../../../script/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/stm.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
apiready = function() {
    var menus = ['我的订单', '我的消息', '我的收藏', '退出登录'];
    var cancel = '关闭菜单';
    islogin(0)

    
    
}


function person(){
    toDetails('','my',0);
}

function save(){

    var password1 = hui("#password1").val();
    var password2 = hui("#password2").val();

    if (password1 == '') {
        api.toast({ msg:'密码不能为空',location:'top' })
        return false;
    }
    if (password2 == '') {
        api.toast({ msg:'确认密码不能为空',location:'top' })
        return false;
    }
    if (password1 != password2) {
        api.toast({ msg:'两次密码输入不一致',location:'top' })
        return false;
    }
    api.ajax({
        url: $api.getStorage('geturl')+'&c=ajaxmember&a=updatepassword',
        method: 'post',
        data: {
            values: { 
                userid : $api.getStorage('userid'),
                password : password1
            }
        }
    },function(ret, err){
        if (ret) {
            console.log(JSON.stringify(ret))
            if (ret.status==1) {
                api.toast({ msg:ret.tip,location:'top' })
                setTimeout("person()",2000)
            }
        } else {
            alert( JSON.stringify( err ) );
        }
    });    
    
}
</script>

</body>
</html>